package main

import "fmt"

func main() {
	fmt.Printf("fib(6)=%d\n", Fibonacci(6))
	println("hello world")
	fmt.Printf("fib(6)=%d\n", Fibonacci2(6))
	test()
}

func test() {
	fmt.Printf("------------------\n")
	for i := 1; i <= 9; i++ {
		for j := 1; j <= i; j++ {
			fmt.Printf("%dx%d=%2d ", i, j, i*j)
		}
		fmt.Printf("\n")
	}
	fmt.Printf("------------------\n")
}

func Fibonacci(n int) int {
	if n <= 1 {
		return n
	}
	return Fibonacci(n-1) + Fibonacci(n-2)
}

func Fibonacci2(n int) (res int) {
	if n <= 1 {
		return n
	}
	n1 := 0
	n2 := 1
	for i := 2; i <= n; i++ {
		res = n1 + n2
		n1 = n2
		n2 = res
	}
	return
}

func calc(n int) int {
	return n * n
}

// 0 1 1 2 3 5 8
